package com.nuc.list1;

import java.util.ArrayList;
import java.util.List;

/**
 * Time    : 2023/3/30 10:00
 * Author  : 王摇摆
 * FileName: Demo3.java
 * Software: IntelliJ IDEA 2020.2.2
 * Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
 */

public class Demo3 {
    public static void main(String[] args) {
        String a = "白龙马", b = "沙和尚", c = "八戒", d = "唐僧", e = "王摇摆";
        List<String> people = new ArrayList<>();

        people.add(a);
        people.add(b);
        people.add(c);
        System.out.println("Now the List value is:");
        for (String peos : people) {
            System.out.print(peos + "\t");
        }
        System.out.println();
        System.out.println("----------------");


        people.set(0, d);
        for (String peos : people) {
            System.out.print(peos + "\t");
        }
        System.out.println();
        System.out.println("----------------");


        people.add(1, e);
        for (String peos : people) {
            System.out.print(peos + "\t");
        }
        System.out.println();
        System.out.println("The number of the List is "+people.size());
        System.out.println("----------------");
    }
}
